home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / falcon / nt_dsp1.lzh / NT_DSP1.MSA / FNTNS / LOG2.HLP < prev    next >
Encoding:
Text File  |  1989-01-24  |  743 b   |  25 lines

  1.          Name: LOG2.ASM
  2.          Type: Assembler Macro
  3.       Version: 1.0
  4.   Last Change: 26-Jan-87
  5.  
  6.  This macro will take the log2 of a number by polynomial approximation.
  7.  
  8.         LOG2(x)= 4.0* (-.3372223 x*x + .9981958 x - .6626105)
  9.  
  10.  This polynomial will give approximately 8 significant bits of accuracy.
  11.  This is valid for .5<= x <= 1.
  12.  
  13.  The input value is put into x0, the output value is in register A.
  14.  Register R1 initially points to the coefficients in y memory in
  15.  the order:a1,a2,a0.
  16.  
  17.        R1
  18.        |
  19.        v
  20.  y:.9981958,-.3372223,-.6626105         
  21.        a1       a2        a0
  22.  
  23.  Benchmarks for this macro is 7 cycles, 7 instructions.
  24.  The library program LOG2T demonstrates how to use the LOG2 macro.
  25.